package com.chukun.gateway.core.filter;

import com.chukun.gateway.core.context.GatewayContext;
import com.chukun.gateway.core.filter.annotation.FilterDefinition;

/**
 * @author chukun
 * @version 1.0.0
 * @description 过滤器顶级接口
 * @createTime 2023/12/3 22:06
 */
public interface Filter {

    void doFilter(GatewayContext ctx) throws  Exception;

    default int getOrder(){
        FilterDefinition annotation = this.getClass().getAnnotation(FilterDefinition.class);
        if(annotation != null){
            return annotation.order();
        }
        return Integer.MAX_VALUE;
    };
}
